<template>
  <div>
      <!-- 分页 -->
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="params.page"
      :page-sizes="[10, 20, 30, 40]"
      :page-size="params.pagesize"
      layout="sizes, prev, pager, next, jumper"
      :total="total">
    </el-pagination>
  </div>
</template>

<script>
export default {
  props: ['total', 'pagenum', 'pagesize'],
  data () {
    return {
      params: {
        page: 1,
        pagesize: 10
      }
    }
  },

  created () {
    this.JSONParams()
  },

  methods: {
    handleSizeChange (val) {
      this.$emit('changePageSize', val)
    },
    handleCurrentChange (val) {
      this.$emit('changePageNum', val)
    },
    JSONParams () {
      this.params.page = this.pagenum
      this.params.pagesize = this.pagesize
    }
  }
}
</script>

<style scoped lang='less'>

</style>
